#ifndef __EKOS_KERNEL_H__
#define __EKOS_KERNEL_H__

/* This file is the internal header file for EKOS-FH, should not be
 * included outside the kernel directory */

#include <layout.h>
#include <mmu.h>
#include <types.h>
#include <x86.h>
#include <x86_lock.h>
#include <stdarg.h>
#include <error.h>
#include <syscall.h>
#include <trap.h>
#include <stab.h>
#include <proc.h>
#include <sysconf.h>

#include <string.h>
#include <ioif.h>
#include <parse.h>

#include "inc/pic.h"
#include "inc/elf.h"

#include "auth/auth.h"

#include "misc/console.h"
#include "misc/io.h"
#include "misc/debug.h"

#include "mem/kpipe.h"
#include "mem/pmem.h"
#include "mem/vmem.h"

#include "sys/acpi.h"
#include "sys/smbios.h"
#include "sys/hpet.h"
#include "sys/sys.h"

#include "cpu/ioapic.h"
#include "cpu/pic.h"
#include "cpu/lapic.h"
#include "cpu/lcpu.h"
#include "cpu/intr.h"
#include "cpu/task.h"
#include "cpu/ipi.h"

#include "proc/proc.h"
#include "proc/ips.h"

#include "syscall.h"

/* Defined in init.S and kernel.ld */
extern char				_start[], _text[], _text_end[], _bss[], _end[];
extern char             user_lib[], user_lib_end[];
extern struct stab_t	__STAB_BEGIN__[];		// Beginning of stabs table
extern struct stab_t	__STAB_END__[];			// End of stabs table
extern char				__STABSTR_BEGIN__[];	// Beginning of string table
extern char				__STABSTR_END__[];		// End of string table

/* Routines and symbols defined in kernel.S */
/* The entries of ISR interrupt */
extern void *isr[];
/* Entries of IRQ interrupt */
extern void *irq[];
/* KPIPE for system logging */
extern struct kpipe_t klog_pipe;

/* The interrupt entry defined in kernel.S */
/* The interrupt entry for syscall */
extern char syscall[];
/* For the yield call */
extern char int_yield[];
/* For return of kernel to user call */
extern char kcb_ret[];
/* For Inter Processor Interrupt */
extern char ipi[];

/* Get current process id by the stack pointer */
int cur_proc_id();
/* Jump to user space */
void jump_ulib(void *addr, void *stack, uint32_t flags);
void call_ulib(void *addr, void *stack, uint32_t flags);

#define EKOS_NAME    "EKOS-FH"
#define EKOS_VERSION "20101206"

#endif
